using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using QuanLyKho.DAL;
using QuanLyKho.Entity;
namespace QuanLyKho.BL
{
    class bNhapKho
    {
          DAO dao = new DAO();
        public int insertNhapKho(eNhapKho nk)
        {
            IList<SqlParameter> paramList = new List<SqlParameter>();
            SqlParameter pr = new SqlParameter("@ngayNhap", SqlDbType.DateTime);
            pr.Value = nk.ngayNhap;
            paramList.Add(pr);

            pr = new SqlParameter("@ncId", SqlDbType.Int);
            pr.Value = nk.nkId;
            paramList.Add(pr);

            pr = new SqlParameter("@nkId", SqlDbType.Int);
            pr.Direction = ParameterDirection.Output;
            paramList.Add(pr);

            int r = dao.ExecuteNonQuery("insertNhapKho", CommandType.StoredProcedure, paramList);
            r =(int) pr.Value;
            dao.CloseConnection();
            return r;

        }
    }
}
